<!--
推荐type=3时，代理商的功能，BD没有
-->
<template>
    <div class="addressList">
      <div class="fixed_head"><span class="goback" @click="goback"><i class="icon-back icon"></i><span class="goback_word">返回</span></span> <span class="title">地址管理</span> </div>
      <div class="mainlist">
        <ul>
          <li  v-for="(item, index)  in addressList" v-on:click.stop="selectedAddress(item,index)">
            <p><span class="name">{{item.name}}</span><span class="tel">{{item.tel}}</span></p>
            <p><span class="defalutaddress"  v-if="item.default == 0">默认</span><span class="address">{{item.address}}</span></p>
            <span class="edit">编辑</span>
          </li>
        </ul>
      </div>
      <wv-button type="primary" class="createAdress" @click="addressAdd">+新建地址</wv-button>
    </div>
</template>

<script>
import info from '../../info.js'

export default {
  name: "addressList",
  data(){
      return{
        msg:"",
        addressList:[
          {
            name:"lisa",
            tel:"15381002814",
            address:"浙江省杭州市西湖区文二西路西溪银座",
            default:0
          },
          {
            name:"xiaoxiao",
            tel:"15381002816",
            address:"宝林公寓",
            default:1
          },
          {
            name:"lili",
            tel:"15381002819",
            address:"新溪口",
            default:1
          }
        ], //获取地址接口
      }
  },
  methods: {
     goback(){
      console.log("--goback")
      this.$router.go(-1)
    },
    addressAdd(){ //跳转添加地址页
      this.$router.push({path:'/addressAdd'});
    },

    selectedAddress(item,index){ //选择地址
      console.log(JSON.stringify(item)+index);  
      this.msg = item; 
      this.$router.push({path:'/orderWashing'});
    }
  },
  beforeDestroy () { //销毁前监听事件
    this.$root.bus.$emit('eventName', this.msg)
  }

 
  
};
</script>


<style lang="scss">
@import '../../base/reset.scss';
@import "../../base/common.scss";
.addressList {
  text-align: left;
  .createAdress {
    position: fixed;
    width: 90%;
    left: 5%;
    bottom: 10px;
    background: #6DA93F
  }
  .mainlist {
    margin-top: pxTorem(20);
    ul
     li {
        position: relative;
        font-size: pxTorem(28);
        padding: pxTorem(20) pxTorem(30);
        .tel {
           
        }
        .name {
           margin-right: pxTorem(20);
        }
        .defalutaddress {
          color: #6DA93F;
          margin-right: pxTorem(10);
          font-size: pxTorem(24);
        }
        .address {
          color: #ddd;
          font-size: pxTorem(24);
        }
        &:after {
          content: " ";
          position: absolute;
          left: 0;
          right: 0;
          height: 1px;
          color: #e5e5e5;
          z-index: 2;
          bottom: 0;
          border-bottom: 1px solid #e5e5e5;
          -webkit-transform-origin: 0 100%;
          transform-origin: 0 100%;
          -webkit-transform: scaleY(.5);
          transform: scaleY(.5);
        }
        .edit {
          position: absolute;
          right: pxTorem(30);
          top: pxTorem(30);
          color:#1aad19;
        }
     }
  }

}



</style>